﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel;
using System.Text;
using Global.Class.Library;

namespace DataTransferObject
{

    public class MarketingIncentiveMaster : NotifyPropertyChangeObject
    {

        private int marketingIncentiveID;

        private string paymentPeriod;
        private string paymentMachanics;
        
        private int marketingProgramID;
        private int marketingPaymentTypeID;

        private int requestedEmployeeID;
        private int notedEmployeeID;
        private int approvedEmployeeID;

        private DateTime requestedDate;
        private DateTime entryDate;

        private string remarks;



        public MarketingIncentiveMaster()
        {
            GlobalDefaultValue.Apply(this);

            this.RequestedDate = DateTime.Today;
            this.EntryDate = DateTime.Today;
        }

        #region Properties


        [DefaultValue(-1)]
        public int MarketingIncentiveID
        {
            get { return this.marketingIncentiveID; }
            set { ApplyPropertyChange<MarketingIncentiveMaster, int>(ref this.marketingIncentiveID, o => o.MarketingIncentiveID, value); }
        }


        [DefaultValue("")]
        public string PaymentPeriod
        {
            get { return this.paymentPeriod; }
            set { ApplyPropertyChange<MarketingIncentiveMaster, string>(ref this.paymentPeriod, o => o.PaymentPeriod, value.Trim()); }
        }


        [DefaultValue("")]
        public string PaymentMachanics
        {
            get { return this.paymentMachanics; }
            set { ApplyPropertyChange<MarketingIncentiveMaster, string>(ref this.paymentMachanics, o => o.PaymentMachanics, value); }
        }


        [DefaultValue("")]
        public string Remarks
        {
            get { return this.remarks; }
            set { ApplyPropertyChange<MarketingIncentiveMaster, string>(ref this.remarks, o => o.Remarks, value); }
        }

        
        
        [DefaultValue(0)]
        public int MarketingProgramID
        {
            get { return this.marketingProgramID; }
            set { ApplyPropertyChange<MarketingIncentiveMaster, int>(ref this.marketingProgramID, o => o.MarketingProgramID, value); }
        }

        [DefaultValue(0)]
        public int MarketingPaymentTypeID
        {
            get { return this.marketingPaymentTypeID; }
            set { ApplyPropertyChange<MarketingIncentiveMaster, int>(ref this.marketingPaymentTypeID, o => o.MarketingPaymentTypeID, value); }
        }

        [DefaultValue(0)]
        public int RequestedEmployeeID
        {
            get { return this.requestedEmployeeID; }
            set { ApplyPropertyChange<MarketingIncentiveMaster, int>(ref this.requestedEmployeeID, o => o.RequestedEmployeeID, value); }
        }


        [DefaultValue(0)]
        public int NotedEmployeeID
        {
            get { return this.notedEmployeeID; }
            set { ApplyPropertyChange<MarketingIncentiveMaster, int>(ref this.notedEmployeeID, o => o.NotedEmployeeID, value); }
        }


        [DefaultValue(0)]
        public int ApprovedEmployeeID
        {
            get { return this.approvedEmployeeID; }
            set { ApplyPropertyChange<MarketingIncentiveMaster, int>(ref this.approvedEmployeeID, o => o.ApprovedEmployeeID, value); }
        }


        [DefaultValue(typeof(DateTime), "01/01/1900")]
        public DateTime RequestedDate
        {
            get { return this.requestedDate; }
            set { ApplyPropertyChange<MarketingIncentiveMaster, DateTime>(ref this.requestedDate, o => o.RequestedDate, value); }
        }

        [DefaultValue(typeof(DateTime), "01/01/1900")]
        public DateTime EntryDate
        {
            get { return this.entryDate; }
            set { ApplyPropertyChange<MarketingIncentiveMaster, DateTime>(ref this.entryDate, o => o.EntryDate, value); }
        }



        
        #endregion


        protected override System.Collections.Generic.List<ValidationRule> CreateRules()
        {
            List<ValidationRule> validationRules = base.CreateRules();
            validationRules.Add(new SimpleValidationRule("MarketingProgramID", "Please select a program.", delegate { return this.MarketingProgramID > 0; }));
            //validationRules.Add(new SimpleValidationRule("GCGBCommandReferenceAndDate", "Please select a command.", delegate { return this.GCGBCommandID > 0; }));
            validationRules.Add(new SimpleValidationRule("MarketingPaymentTypeID", "Please select a payment term.", delegate { return this.MarketingPaymentTypeID > 0; }));
            validationRules.Add(new SimpleValidationRule("PaymentPeriod", "Reference cannot be blank.", delegate { return this.PaymentPeriod.Length != 0; }));
            validationRules.Add(new SimpleValidationRule("RequestedEmployeeID", "Requested person cannot be empty.", delegate { return this.RequestedEmployeeID != 0; }));
            validationRules.Add(new SimpleValidationRule("NotedEmployeeID", "Noted person cannot be empty.", delegate { return this.NotedEmployeeID != 0; }));
            validationRules.Add(new SimpleValidationRule("ApprovedEmployeeID", "Approved person Name cannot be empty.", delegate { return this.ApprovedEmployeeID != 0; }));

            return validationRules;
        }

    }
}
